package com.stellar.circle.controller.admin.sPostTagMapping;

import com.stellar.circle.controller.admin.sPostTagMapping.vo.SPostTagMappingRequestPageVO;
import com.stellar.circle.controller.admin.sPostTagMapping.vo.SPostTagMappingRequestVO;
import com.stellar.circle.controller.admin.sPostTagMapping.vo.SPostTagMappingResponseVO;
import com.stellar.circle.domain.sPostTagMapping.SPostTagMappingDomainService;

import com.stellar.web.core.bean.PageResult;
import com.stellar.web.core.bean.Result;
import com.stellar.web.core.validator.ValidatorRole;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 帖子话题关联表控制器
 *
 * @author Jqchan
 * @version 1.0
 * @date 2025-05-17 19:30:47
 */
@RequestMapping("/api-admin/sPostTagMapping")
@RestController("adminSPostTagMappingController")
@Slf4j
public class SPostTagMappingController {

    @Resource
    private SPostTagMappingDomainService sPostTagMappingDomainService;

    /**
     * 分页查询帖子话题关联表
     */
    @ValidatorRole
    @PostMapping("/page")
    public Result<PageResult<SPostTagMappingResponseVO>> page(@RequestBody SPostTagMappingRequestPageVO requestPageVO) {
        return Result.success(sPostTagMappingDomainService.page(requestPageVO));
    }

    /**
     * 新增帖子话题关联表
     */
    @ValidatorRole
    @PostMapping("/create")
    public Result<Boolean> create(@RequestBody SPostTagMappingRequestVO requestVO) {
        return Result.success(sPostTagMappingDomainService.insert(requestVO));
    }

    /**
     * 修改帖子话题关联表
     */
    @ValidatorRole
    @PostMapping("/update")
    public Result<Boolean> update(@RequestBody SPostTagMappingRequestVO requestVO) {
        return Result.success(sPostTagMappingDomainService.update(requestVO));
    }

    /**
     * 删除帖子话题关联表
     */
    @ValidatorRole
    @DeleteMapping("/delete/{id}")
    public Result<Boolean> delete(@PathVariable("id") Long id) {
        return Result.success(sPostTagMappingDomainService.delete(id));
    }

    /**
     * 获取帖子话题关联表详情
     */
    @ValidatorRole
    @GetMapping("/get/{id}")
    public Result<SPostTagMappingResponseVO> get(@PathVariable("id") Long id) {
        return Result.success(sPostTagMappingDomainService.get(id));
    }
}
